import request from '@/utils/request'

export function fetchList(params) {
    return request({
        url: '/post/list',
        method: 'get',
        params: params
    })
}

export function fetchFocus() {
    return request({
        url: '/focus/list',
        method: 'get',
        params: {}
    })
}

export function fetchCategory() {
    return request({
        url: '/category',
        method: 'get',
        params: {}
    })
}

export function fetchFriend() {
    return request({
        url: '/friend',
        method: 'get',
        params: {}
    })
}

export function fetchSocial() {
    return request({
        url: '/social',
        method: 'get',
        params: {}
    });
}

export function fetchSiteInfo() {
    return request({
        url: '/site',
        method: 'get',
        params: {}
    })
}

export function fetchComment() {
    return request({
        url: '/comment',
        method: 'get',
        params: {}
    })
}

// 使用的
export function getWebConfig(params) {
    return request({
        url: process.env.VUE_APP_WEB_API + '/webConfig/',
        method: 'get',
        params
    })
}
function blogList(params){
    return request({
        url: process.env.VUE_APP_WEB_API + '/front/listBlog',
        method: 'post',
        data: params
    })
}
export function getNewBlog(params) {
    return blogList(params)
}
// 获取置顶的博客
export function getBlogByLevel(params) {
    return blogList(params)
}

export function searchBlog(params) {
    return request({
        url: process.env.VUE_APP_WEB_API + '/search/elasticSearchBlog',
        method: 'get',
        params
    })
}
